
def sort(s):
    s = list(s)
    print(s)
    num = 0
    for i in range(len(s)-1):
        for j in range(len(s)-1-i):
            if (s[j+1]<s[j]):
                num+=1
                t = s[j+1]
                s[j+1]=s[j]
                s[j] = t
    return num

print(sort("jonmlkihgfedcba"))

